<?php defined('InShopNC') or exit('Access Invalid!');?>
<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <h3>热门搜索管理</h3>
      <ul class="tab-base">
        <li><a href="javascript:;" class="current"><span>热门搜索列表</span></a></li>
        <li><a href="index.php?act=wp_hotSearch&op=search_add"><span>添加热门搜索</span></a></li>
      </ul>
    </div>
  </div>
  <div class="fixed-empty"></div>
  <table class="table tb-type2" id="prompt">
    <tbody>
      <tr class="space odd">
        <th class="nobg" colspan="12"><div class="title"><h5><?php echo $lang['nc_prompts'];?></h5><span class="arrow"></span></div></th>
      </tr>
      <tr>
        <td>
          <ul>
           <li>显示按照排序从小到大排列</li>
          </ul>
        </td>
      </tr>
    </tbody>
  </table>
  <form method='post' id="list_form">
    <input type="hidden" name="form_submit" value="ok" />
    <input type="hidden" name="submit_type" id="submit_type" value="" />
    <input type="hidden" name="class_id" id="class_id">
    <table class="table tb-type2">
      <thead>
        <tr class="thead">
          <th></th>
          <th>热门搜索id</th>
          <th>关键字</th>
          <th>排序</th>
          
          <th>操作</th>
         
        </tr>
      </thead>
      <tbody>
        <?php if (!empty($output['hotsearch_list']) && is_array($output['hotsearch_list'])) { ?>
        <?php foreach ($output['hotsearch_list'] as $val) { ?>
           <tr class="hover edit">
              <td></td>
              <td class="w48 sort">
                <span nc_type="inline_edit" ajax_branch="class" ><?php echo $val['search_id'];?></span>
              </td>
              <td class="name">
                <span nc_type="inline_edit" ajax_branch="class" ><?php echo $val['search_keyword'];?></span>
                
              </td>
              
              <td class="name">
                <span nc_type="inline_edit" ajax_branch="class" ><?php echo $val['sort'];?></span>
                
              </td>
             
              <td class="name">
                <span nc_type="inline_edit"  ><a href="index.php?act=wp_hotSearch&op=search_edt&search_id=<?php echo $val['search_id'];?>"> 编辑</a>&nbsp;&nbsp;
                |&nbsp;&nbsp;<a  data-id="<?php echo $val['search_id'];?>"  href="javascript:void(0);" class='del_search'>确认删除</a></span>
                
              </td>
              
            </tr>
        <?php } ?>
        <?php }  ?>
        
      </tbody>
     
    </table>
  </form>
</div>
<script type="text/javascript">


$('.del_search').click(function(){
	var search_id=$(this).attr("data-id");
	firm(search_id);
	
});

//弹出一个询问框，有确定和取消按钮  
function firm(search_id) {  
    //利用对话框返回的值 （true 或者 false）  
    if (confirm("你确定删除吗？")) {  
    	delete_search(search_id);
    }  
    else {  
        alert("取消操作");  
    }  

} 

/*
 * 删除模板下的所有内容
 */
function delete_search(search_id){
	$.ajax({
	       type: "post",
	       data:{search_id:search_id},
	       url: "index.php?act=wp_hotSearch&op=search_del",
	       dataType: "json",
	       async: true,
	       success: function (data) {
		       if(data==1){
					alert("删除成功");
					location.reload();

		   		}else{
		   			alert("删除失败");
					location.reload();
			   	} 
		   }

	    });
}

function change_status(pro_id,is_release){
	$.ajax({
	       type: "post",
	       data:{pro_id:pro_id,is_release:is_release},
	       url: "index.php?act=discount_promotion&op=change_status",
	       dataType: "json",
	       async: true,
	       success: function (data) {

		       if(data==1){
					alert("成功");
					location.reload();

		   		}else{
		   			alert("失败");
					location.reload();
			   	}
		      
		       
		   }

	    });
}


</script>

